package cn.bb.dao;

import cn.bb.pojo.Person;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("personDao")
public class IPersonDaoImpl extends HibernateTemplate implements IPersonDao {
    @Autowired
    @Qualifier(value = "sessionFactory")
    private SessionFactory sessionFactory;
    @Override
    public List<Person> search() {
        return find("from Person");
    }

    @Override
    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    @Override
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }
}
